package team.seekers.catering.common.utils;

import org.springframework.security.core.context.SecurityContextHolder;
import team.seekers.catering.common.enums.RoleEnum;
import team.seekers.catering.user.entity.dao.User;

public class CateringUtil {


    public static String getUserId(){
        User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        return user.getId();
    }

    public static boolean isCourier(){
        User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        return user.getRole().equals(RoleEnum.COURIER);
    }

}
